package com.jic.member.impl;

import java.lang.Long;
import java.util.List;

import com.jic.common.base.vo.Page;
import com.jic.common.base.vo.PageResult;
import com.jic.member.entity.MememberGradeOrderMany;
import com.jic.member.mapper.MememberGradeOrderManyMapper;
import com.jic.member.service.MememberGradeOrderManyService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 会员等级管理-成长值规则-N次下单-充值赠送表
 * @author : 
 * @email : 
 * @since : 2020-04-02 08:01:50
 * @version : v1.0.0
 */
@Service
public class MememberGradeOrderManyServiceImpl implements MememberGradeOrderManyService{

    @Autowired
    private MememberGradeOrderManyMapper mememberGradeOrderManyMapper;

    @Override
    public long insert(MememberGradeOrderMany mememberGradeOrderMany) {
        long flag = mememberGradeOrderManyMapper.insert(mememberGradeOrderMany);
        return flag;
    }

    @Override
    public long delete(Long id) {
        return mememberGradeOrderManyMapper.delete(id);
    }

    @Override
    public long update(MememberGradeOrderMany mememberGradeOrderMany) {
        return mememberGradeOrderManyMapper.update(mememberGradeOrderMany);
    }

    @Override
    public MememberGradeOrderMany queryByPrimaryKey(Long id){
        return mememberGradeOrderManyMapper.queryByPrimaryKey(id);
    }

    @Override
    public List<MememberGradeOrderMany> query(MememberGradeOrderMany mememberGradeOrderMany){
        return mememberGradeOrderManyMapper.query(mememberGradeOrderMany);
    }

    @Override
    public PageResult<MememberGradeOrderMany> queryPage(MememberGradeOrderMany mememberGradeOrderMany, Page pageQuery) {
        //计算下标
        int startIndex = (pageQuery.getStart() - 1) * pageQuery.getLimit();
        List<MememberGradeOrderMany> list = mememberGradeOrderManyMapper.queryPage(startIndex, pageQuery.getLimit(), mememberGradeOrderMany);
        long count = mememberGradeOrderManyMapper.queryPageCount(mememberGradeOrderMany);
        PageResult pageResult = new PageResult();
        pageResult.setRows(list);
        pageResult.setTotal(count);
        return pageResult;
    }
}